package com.gusha.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.gusha.config.GxAdminPropertiesConfig;

@Component
public class Constants {
	
	@Autowired
	private GxAdminPropertiesConfig config;
	
	/**
	 * 图片物理地址
	 */  
    public static String IMAGE_LOCAL_PATH; 
    
    /**
	 * 图片前缀
	 */  
    public static String IMAGE_PATH; 

	/**
	 * 默认每页几条 后台
	 */
	public static final int DEFAULT_PAGESIZE = 10;
	/**
	 * 默认排序字段
	 */
	public static final String DEFAULT_SORT = "id";
	/**
	 * 默认密码
	 */
	public static final String DEFAULT_PASSWORD = "123456";
	/**
	 * 资讯分类ID
	 */
	public static final String CLASSIFY_INFO = "1";
	
	public static final String TICKET = "36";
	/**
	 * 项目分类ID
	 */
	public static final String CLASSIFY_PROJECT = "11";
	
	/**
	 * 用户类别
	 */
	public static final int USER_DLS = 2;
	
	public static final int USER_YWY = 3;
	
	public static final int USER_YYB = 4;
	
	public static final int USER_YYBYWY = 5;
	
	/**
	 * 审核状态
	 */
	public static final int CHECK_SUC = 1;
	
	public static final int CHECK_FAI = 0;
	
	/**
	 * 删除标记
	 */
	public static final Integer RECOVERY = 0;//未删

	public static final Integer DELETE = 1;//已删
	
	public static String getUserNo(String type) {
		return type + "-" + System.currentTimeMillis();
	}

	public static String getFilePath(String type) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
		return "upload/"+ type + "/" + sdf.format(new Date()) + "/";
	}
	
	@PostConstruct
	public void init() {
		IMAGE_LOCAL_PATH = config.getIMAGE_LOCAL_PATH();
		IMAGE_PATH = config.getIMAGE_PATH();
	}
}
